import request from '@/utils/request'

/**
 * 获取楼宇列表
 * @param params {{pageSize: number, page: number}}
 * @returns {*}
 */
export function getCardListAPI(params) {
  return request({
    url: '/parking/card/list',
    method: 'GET',
    params: params
  })
}

/**
 * @description: 添加月卡
 * @param data { personName: string, phoneNumber: string, carNumber: string, carBrand: string, cardStartDate: string, cardEndDate: string, paymentAmount: string, paymentMethod: string, paymentDate: string, paymentOperator: string, cardStatus: string, cardType: string, cardRemark: string}
 * @returns {*}
 */
export function createCardAPI(data) {
  return request({
    url: '/parking/card',
    method: 'POST',
    data: data
  })
}

/**
 * @description: 获取月卡详情
 * @param id
 * @returns {*}
 */
export function getCardDetailAPI(id) {
  return request({
    url: `/parking/card/detail/${id}`,
    method: 'GET'
  })
}

/**
 * @description: 编辑月卡
 * @param data {string}
 * @returns {*}
 */
export function editCardAPI(data) {
  return request({
    url: `parking/card/edit`,
    method: 'PUT',
    data: data
  })
}

/**
 * parking/card/{ids}
 * @description: 删除单张月卡
 * @param id
 * @returns {*}
 */
export function deleteCardAPI(id) {
  return request({
    url: `/parking/card/${id}`,
    method: 'DELETE'
  })
}
/**
 * parking/card/{ids}
 * @description: 批量删除月卡
 * @param ids
 * @returns {*}
 */
export function deleteCardsAPI(ids) {
  return request({
    url: `/parking/card/${ids.join(',')}`,
    method: 'DELETE'
  })
}

/** https://api-hmzs.itheima.net/api/parking/card/proportion
 * @description 获取停车位数
 */
export function getCardTotalAPI() {
  return request({
    url: '/parking/card/proportion',
    method: 'GET'
  })
}
